package com.huiquan.management.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.huiquan.analysis.domain.User;
import com.huiquan.foundation.constant.RoleID;

@Controller
public class ManagementIndexController {

	@Autowired
	private OnlineTimeStatisticController onlineTimeStatisticController;

	@RequestMapping(value = "/management/index.htm")
	public ModelAndView list(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		User user = (User) req.getSession().getAttribute("user");
		int role = user.getRole();
		if (role == RoleID.ADMIN.getId()) {
			return onlineTimeStatisticController.onlineTimeStatisticList(req, resp);
		} else {
			return null;
		}
	}
}
